package com.ten.mall.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ten.mall.mapper.LunboMapper;
import com.ten.mall.service.LunboService;
import com.ten.mall.vo.Lunbo;
import com.ten.mall.vo.LunboExample;
@Service
@Transactional
public class LunboServiceImpl implements LunboService {
	@Autowired
	private LunboMapper lunboMapper;
	@Override
	public int updateLunbo(Lunbo lunbo) {
		int i =lunboMapper.updateByPrimaryKeySelective(lunbo);
		return i;
	}

	@Override
	public int deleteLunbo(Integer id) {
		int i =lunboMapper.deleteByPrimaryKey(id);
		return i;
	}

	@Override
	public int insertLunbo(Lunbo lunbo) {
		int i =lunboMapper.insert(lunbo);
		return i;
	}

	@Override
	@Transactional(readOnly=true)
	public Lunbo selectById(Integer id) {
		Lunbo lunbo =lunboMapper.selectByPrimaryKey(id);
		return lunbo;
	}

	@Override
	@Transactional(readOnly=true)
	public List<Lunbo> selectAll() {
		LunboExample example =new LunboExample();
		example.setOrderByClause("pic_sort");
		List<Lunbo> list =lunboMapper.selectByExample(example);
		return list;
	}

}
